import os

# 指定文件夹路径
folder_path = r"C:\Users\26274\Desktop\aaa"

# 指定要查找的关键词
keywords = [
    "production.INFO: Distirbute ERROR:Attempt to read property \"company\" on null",
    "production.ERROR: Attempt to read property \"company_id\" on null",
    "production.ERROR: IlluminatelValidation\ValidationException",
    "Integrity constraint violation: 1048 Column 'settlement_bank_name' cannot be null",
]

# 遍历文件夹中的所有.log文件
for filename in os.listdir(folder_path):
    if filename.endswith(".log"):
        file_path = os.path.join(folder_path, filename)
        with open(file_path, "r", encoding="utf-8") as file:
            lines = file.readlines()
            for line in lines:
                for keyword in keywords:
                    if keyword in line:
                        print(f"文件名: {filename}")
                        print(f"包含信息: {line}")
